<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>abstractdialog.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_ui_editor_abstractdialog.js.html">abstractdialog.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2008 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Wrapper around {@link goog.ui.Dialog}, to provide
<a name="line17"></a> * dialogs that are smarter about interacting with a rich text editor.
<a name="line18"></a> *
<a name="line19"></a> */
<a name="line20"></a>
<a name="line21"></a>goog.provide(&#39;goog.ui.editor.AbstractDialog&#39;);
<a name="line22"></a>goog.provide(&#39;goog.ui.editor.AbstractDialog.Builder&#39;);
<a name="line23"></a>goog.provide(&#39;goog.ui.editor.AbstractDialog.EventType&#39;);
<a name="line24"></a>
<a name="line25"></a>goog.require(&#39;goog.dom&#39;);
<a name="line26"></a>goog.require(&#39;goog.dom.classes&#39;);
<a name="line27"></a>goog.require(&#39;goog.events.EventTarget&#39;);
<a name="line28"></a>goog.require(&#39;goog.ui.Dialog&#39;);
<a name="line29"></a>goog.require(&#39;goog.ui.Dialog.ButtonSet&#39;);
<a name="line30"></a>goog.require(&#39;goog.ui.Dialog.DefaultButtonKeys&#39;);
<a name="line31"></a>goog.require(&#39;goog.ui.Dialog.Event&#39;);
<a name="line32"></a>goog.require(&#39;goog.ui.Dialog.EventType&#39;);
<a name="line33"></a>
<a name="line34"></a>
<a name="line35"></a>// *** Public interface ***************************************************** //
<a name="line36"></a>
<a name="line37"></a>
<a name="line38"></a>
<a name="line39"></a>/**
<a name="line40"></a> * Creates an object that represents a dialog box.
<a name="line41"></a> * @param {goog.dom.DomHelper} domHelper DomHelper to be used to create the
<a name="line42"></a> * dialog&#39;s dom structure.
<a name="line43"></a> * @constructor
<a name="line44"></a> * @extends {goog.events.EventTarget}
<a name="line45"></a> */
<a name="line46"></a>goog.ui.editor.AbstractDialog = function(domHelper) {
<a name="line47"></a>  goog.events.EventTarget.call(this);
<a name="line48"></a>  this.dom = domHelper;
<a name="line49"></a>};
<a name="line50"></a>goog.inherits(goog.ui.editor.AbstractDialog, goog.events.EventTarget);
<a name="line51"></a>
<a name="line52"></a>
<a name="line53"></a>/**
<a name="line54"></a> * Causes the dialog box to appear, centered on the screen. Lazily creates the
<a name="line55"></a> * dialog if needed.
<a name="line56"></a> */
<a name="line57"></a>goog.ui.editor.AbstractDialog.prototype.show = function() {
<a name="line58"></a>  // Lazily create the wrapped dialog to be shown.
<a name="line59"></a>  if (!this.dialogInternal_) {
<a name="line60"></a>    this.dialogInternal_ = this.createDialogControl();
<a name="line61"></a>    this.dialogInternal_.addEventListener(goog.ui.Dialog.EventType.AFTER_HIDE,
<a name="line62"></a>        this.handleAfterHide_, false, this);
<a name="line63"></a>  }
<a name="line64"></a>
<a name="line65"></a>  this.dialogInternal_.setVisible(true);
<a name="line66"></a>};
<a name="line67"></a>
<a name="line68"></a>
<a name="line69"></a>/**
<a name="line70"></a> * Hides the dialog, causing AFTER_HIDE to fire.
<a name="line71"></a> */
<a name="line72"></a>goog.ui.editor.AbstractDialog.prototype.hide = function() {
<a name="line73"></a>  if (this.dialogInternal_) {
<a name="line74"></a>    // This eventually fires the wrapped dialog&#39;s AFTER_HIDE event, calling our
<a name="line75"></a>    // handleAfterHide_().
<a name="line76"></a>    this.dialogInternal_.setVisible(false);
<a name="line77"></a>  }
<a name="line78"></a>};
<a name="line79"></a>
<a name="line80"></a>
<a name="line81"></a>/**
<a name="line82"></a> * @return {boolean} Whether the dialog is open.
<a name="line83"></a> */
<a name="line84"></a>goog.ui.editor.AbstractDialog.prototype.isOpen = function() {
<a name="line85"></a>  return !!this.dialogInternal_ &amp;&amp; this.dialogInternal_.isVisible();
<a name="line86"></a>};
<a name="line87"></a>
<a name="line88"></a>
<a name="line89"></a>/**
<a name="line90"></a> * Runs the handler registered on the OK button event and closes the dialog if
<a name="line91"></a> * that handler succeeds.
<a name="line92"></a> * This is useful in cases such as double-clicking an item in the dialog is
<a name="line93"></a> * equivalent to selecting it and clicking the default button.
<a name="line94"></a> * @protected
<a name="line95"></a> */
<a name="line96"></a>goog.ui.editor.AbstractDialog.prototype.processOkAndClose = function() {
<a name="line97"></a>  // Fake an OK event from the wrapped dialog control.
<a name="line98"></a>  var evt = new goog.ui.Dialog.Event(goog.ui.Dialog.DefaultButtonKeys.OK, null);
<a name="line99"></a>  if (this.handleOk(evt)) {
<a name="line100"></a>    // handleOk calls dispatchEvent, so if any listener calls preventDefault it
<a name="line101"></a>    // will return false and we won&#39;t hide the dialog.
<a name="line102"></a>    this.hide();
<a name="line103"></a>  }
<a name="line104"></a>};
<a name="line105"></a>
<a name="line106"></a>
<a name="line107"></a>// *** Dialog events ******************************************************** //
<a name="line108"></a>
<a name="line109"></a>
<a name="line110"></a>/**
<a name="line111"></a> * Event type constants for events the dialog fires.
<a name="line112"></a> * @enum {string}
<a name="line113"></a> */
<a name="line114"></a>goog.ui.editor.AbstractDialog.EventType = {
<a name="line115"></a>  // This event is fired after the dialog is hidden, no matter if it was closed
<a name="line116"></a>  // via OK or Cancel or is being disposed without being hidden first.
<a name="line117"></a>  AFTER_HIDE: &#39;afterhide&#39;,
<a name="line118"></a>  // Either the cancel or OK events can be canceled via preventDefault or by
<a name="line119"></a>  // returning false from their handlers to stop the dialog from closing.
<a name="line120"></a>  CANCEL: &#39;cancel&#39;,
<a name="line121"></a>  OK: &#39;ok&#39;
<a name="line122"></a>};
<a name="line123"></a>
<a name="line124"></a>
<a name="line125"></a>// *** Inner helper class *************************************************** //
<a name="line126"></a>
<a name="line127"></a>
<a name="line128"></a>
<a name="line129"></a>/**
<a name="line130"></a> * A builder class for the dialog control. All methods except build return this.
<a name="line131"></a> * @param {goog.ui.editor.AbstractDialog} editorDialog Editor dialog object
<a name="line132"></a> *     that will wrap the wrapped dialog object this builder will create.
<a name="line133"></a> * @constructor
<a name="line134"></a> */
<a name="line135"></a>goog.ui.editor.AbstractDialog.Builder = function(editorDialog) {
<a name="line136"></a>  // We require the editor dialog to be passed in so that the builder can set up
<a name="line137"></a>  // ok/cancel listeners by default, making it easier for most dialogs.
<a name="line138"></a>  this.editorDialog_ = editorDialog;
<a name="line139"></a>  this.wrappedDialog_ = new goog.ui.Dialog(&#39;&#39;, true, this.editorDialog_.dom);
<a name="line140"></a>  this.buttonSet_ = new goog.ui.Dialog.ButtonSet(this.editorDialog_.dom);
<a name="line141"></a>  this.buttonHandlers_ = {};
<a name="line142"></a>  this.addClassName(goog.getCssName(&#39;tr-dialog&#39;));
<a name="line143"></a>};
<a name="line144"></a>
<a name="line145"></a>
<a name="line146"></a>/**
<a name="line147"></a> * Sets the title of the dialog.
<a name="line148"></a> * @param {string} title Title HTML (escaped).
<a name="line149"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line150"></a> */
<a name="line151"></a>goog.ui.editor.AbstractDialog.Builder.prototype.setTitle = function(title) {
<a name="line152"></a>  this.wrappedDialog_.setTitle(title);
<a name="line153"></a>  return this;
<a name="line154"></a>};
<a name="line155"></a>
<a name="line156"></a>
<a name="line157"></a>/**
<a name="line158"></a> * Adds an OK button to the dialog. Clicking this button will cause {@link
<a name="line159"></a> * handleOk} to run, subsequently dispatching an OK event.
<a name="line160"></a> * @param {string=} opt_label The caption for the button, if not &quot;OK&quot;.
<a name="line161"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line162"></a> */
<a name="line163"></a>goog.ui.editor.AbstractDialog.Builder.prototype.addOkButton =
<a name="line164"></a>    function(opt_label) {
<a name="line165"></a>  var key = goog.ui.Dialog.DefaultButtonKeys.OK;
<a name="line166"></a>  /** @desc Label for an OK button in an editor dialog. */
<a name="line167"></a>  var MSG_TR_DIALOG_OK = goog.getMsg(&#39;OK&#39;);
<a name="line168"></a>  // True means this is the default/OK button.
<a name="line169"></a>  this.buttonSet_.set(key, opt_label || MSG_TR_DIALOG_OK, true);
<a name="line170"></a>  this.buttonHandlers_[key] = goog.bind(this.editorDialog_.handleOk,
<a name="line171"></a>                                        this.editorDialog_);
<a name="line172"></a>  return this;
<a name="line173"></a>};
<a name="line174"></a>
<a name="line175"></a>
<a name="line176"></a>/**
<a name="line177"></a> * Adds a Cancel button to the dialog. Clicking this button will cause {@link
<a name="line178"></a> * handleCancel} to run, subsequently dispatching a CANCEL event.
<a name="line179"></a> * @param {string=} opt_label The caption for the button, if not &quot;Cancel&quot;.
<a name="line180"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line181"></a> */
<a name="line182"></a>goog.ui.editor.AbstractDialog.Builder.prototype.addCancelButton =
<a name="line183"></a>    function(opt_label) {
<a name="line184"></a>  var key = goog.ui.Dialog.DefaultButtonKeys.CANCEL;
<a name="line185"></a>  /** @desc Label for a cancel button in an editor dialog. */
<a name="line186"></a>  var MSG_TR_DIALOG_CANCEL = goog.getMsg(&#39;Cancel&#39;);
<a name="line187"></a>  // False means it&#39;s not the OK button, true means it&#39;s the Cancel button.
<a name="line188"></a>  this.buttonSet_.set(key, opt_label || MSG_TR_DIALOG_CANCEL, false, true);
<a name="line189"></a>  this.buttonHandlers_[key] = goog.bind(this.editorDialog_.handleCancel,
<a name="line190"></a>                                        this.editorDialog_);
<a name="line191"></a>  return this;
<a name="line192"></a>};
<a name="line193"></a>
<a name="line194"></a>
<a name="line195"></a>/**
<a name="line196"></a> * Adds a custom button to the dialog.
<a name="line197"></a> * @param {string} label The caption for the button.
<a name="line198"></a> * @param {function(goog.ui.Dialog.EventType):*} handler Function called when
<a name="line199"></a> *     the button is clicked. It is recommended that this function be a method
<a name="line200"></a> *     in the concrete subclass of AbstractDialog using this Builder, and that
<a name="line201"></a> *     it dispatch an event (see {@link handleOk}).
<a name="line202"></a> * @param {string=} opt_buttonId Identifier to be used to access the button when
<a name="line203"></a> *     calling AbstractDialog.getButtonElement().
<a name="line204"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line205"></a> */
<a name="line206"></a>goog.ui.editor.AbstractDialog.Builder.prototype.addButton =
<a name="line207"></a>    function(label, handler, opt_buttonId) {
<a name="line208"></a>  // We don&#39;t care what the key is, just that we can match the button with the
<a name="line209"></a>  // handler function later.
<a name="line210"></a>  var key = opt_buttonId || goog.string.createUniqueString();
<a name="line211"></a>  this.buttonSet_.set(key, label);
<a name="line212"></a>  this.buttonHandlers_[key] = handler;
<a name="line213"></a>  return this;
<a name="line214"></a>};
<a name="line215"></a>
<a name="line216"></a>
<a name="line217"></a>/**
<a name="line218"></a> * Puts a CSS class on the dialog&#39;s main element.
<a name="line219"></a> * @param {string} className The class to add.
<a name="line220"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line221"></a> */
<a name="line222"></a>goog.ui.editor.AbstractDialog.Builder.prototype.addClassName =
<a name="line223"></a>    function(className) {
<a name="line224"></a>  goog.dom.classes.add(this.wrappedDialog_.getDialogElement(), className);
<a name="line225"></a>  return this;
<a name="line226"></a>};
<a name="line227"></a>
<a name="line228"></a>
<a name="line229"></a>/**
<a name="line230"></a> * Sets the content element of the dialog.
<a name="line231"></a> * @param {Element} contentElem An element for the main body.
<a name="line232"></a> * @return {goog.ui.editor.AbstractDialog.Builder} This.
<a name="line233"></a> */
<a name="line234"></a>goog.ui.editor.AbstractDialog.Builder.prototype.setContent =
<a name="line235"></a>    function(contentElem) {
<a name="line236"></a>  goog.dom.appendChild(this.wrappedDialog_.getContentElement(), contentElem);
<a name="line237"></a>  return this;
<a name="line238"></a>};
<a name="line239"></a>
<a name="line240"></a>
<a name="line241"></a>/**
<a name="line242"></a> * Builds the wrapped dialog control. May only be called once, after which
<a name="line243"></a> * no more methods may be called on this builder.
<a name="line244"></a> * @return {goog.ui.Dialog} The wrapped dialog control.
<a name="line245"></a> */
<a name="line246"></a>goog.ui.editor.AbstractDialog.Builder.prototype.build = function() {
<a name="line247"></a>  if (this.buttonSet_.isEmpty()) {
<a name="line248"></a>    // If caller didn&#39;t set any buttons, add an OK and Cancel button by default.
<a name="line249"></a>    this.addOkButton();
<a name="line250"></a>    this.addCancelButton();
<a name="line251"></a>  }
<a name="line252"></a>  this.wrappedDialog_.setButtonSet(this.buttonSet_);
<a name="line253"></a>
<a name="line254"></a>  var handlers = this.buttonHandlers_;
<a name="line255"></a>  this.buttonHandlers_ = null;
<a name="line256"></a>  this.wrappedDialog_.addEventListener(goog.ui.Dialog.EventType.SELECT,
<a name="line257"></a>      // Listen for the SELECT event, which means a button was clicked, and
<a name="line258"></a>      // call the handler associated with that button via the key property.
<a name="line259"></a>      function(e) {
<a name="line260"></a>        if (handlers[e.key]) {
<a name="line261"></a>          return handlers[e.key](e);
<a name="line262"></a>        }
<a name="line263"></a>      });
<a name="line264"></a>
<a name="line265"></a>  // All editor dialogs are modal.
<a name="line266"></a>  this.wrappedDialog_.setModal(true);
<a name="line267"></a>
<a name="line268"></a>  var dialog = this.wrappedDialog_;
<a name="line269"></a>  this.wrappedDialog_ = null;
<a name="line270"></a>  return dialog;
<a name="line271"></a>};
<a name="line272"></a>
<a name="line273"></a>
<a name="line274"></a>/**
<a name="line275"></a> * Editor dialog that will wrap the wrapped dialog this builder will create.
<a name="line276"></a> * @type {goog.ui.editor.AbstractDialog}
<a name="line277"></a> * @private
<a name="line278"></a> */
<a name="line279"></a>goog.ui.editor.AbstractDialog.Builder.prototype.editorDialog_;
<a name="line280"></a>
<a name="line281"></a>
<a name="line282"></a>/**
<a name="line283"></a> * wrapped dialog control being built by this builder.
<a name="line284"></a> * @type {goog.ui.Dialog}
<a name="line285"></a> * @private
<a name="line286"></a> */
<a name="line287"></a>goog.ui.editor.AbstractDialog.Builder.prototype.wrappedDialog_;
<a name="line288"></a>
<a name="line289"></a>
<a name="line290"></a>/**
<a name="line291"></a> * Set of buttons to be added to the wrapped dialog control.
<a name="line292"></a> * @type {goog.ui.Dialog.ButtonSet}
<a name="line293"></a> * @private
<a name="line294"></a> */
<a name="line295"></a>goog.ui.editor.AbstractDialog.Builder.prototype.buttonSet_;
<a name="line296"></a>
<a name="line297"></a>
<a name="line298"></a>/**
<a name="line299"></a> * Map from keys that will be returned in the wrapped dialog SELECT events to
<a name="line300"></a> * handler functions to be called to handle those events.
<a name="line301"></a> * @type {Object}
<a name="line302"></a> * @private
<a name="line303"></a> */
<a name="line304"></a>goog.ui.editor.AbstractDialog.Builder.prototype.buttonHandlers_;
<a name="line305"></a>
<a name="line306"></a>
<a name="line307"></a>// *** Protected interface ************************************************** //
<a name="line308"></a>
<a name="line309"></a>
<a name="line310"></a>/**
<a name="line311"></a> * The DOM helper for the parent document.
<a name="line312"></a> * @type {goog.dom.DomHelper}
<a name="line313"></a> * @protected
<a name="line314"></a> */
<a name="line315"></a>goog.ui.editor.AbstractDialog.prototype.dom;
<a name="line316"></a>
<a name="line317"></a>
<a name="line318"></a>/**
<a name="line319"></a> * Creates and returns the goog.ui.Dialog control that is being wrapped
<a name="line320"></a> * by this object.
<a name="line321"></a> * @return {goog.ui.Dialog} Created Dialog control.
<a name="line322"></a> * @protected
<a name="line323"></a> */
<a name="line324"></a>goog.ui.editor.AbstractDialog.prototype.createDialogControl =
<a name="line325"></a>    goog.abstractMethod;
<a name="line326"></a>
<a name="line327"></a>
<a name="line328"></a>/**
<a name="line329"></a> * Returns the HTML Button element for the OK button in this dialog.
<a name="line330"></a> * @return {Element} The button element if found, else null.
<a name="line331"></a> * @protected
<a name="line332"></a> */
<a name="line333"></a>goog.ui.editor.AbstractDialog.prototype.getOkButtonElement = function() {
<a name="line334"></a>  return this.getButtonElement(goog.ui.Dialog.DefaultButtonKeys.OK);
<a name="line335"></a>};
<a name="line336"></a>
<a name="line337"></a>
<a name="line338"></a>/**
<a name="line339"></a> * Returns the HTML Button element for the Cancel button in this dialog.
<a name="line340"></a> * @return {Element} The button element if found, else null.
<a name="line341"></a> * @protected
<a name="line342"></a> */
<a name="line343"></a>goog.ui.editor.AbstractDialog.prototype.getCancelButtonElement = function() {
<a name="line344"></a>  return this.getButtonElement(goog.ui.Dialog.DefaultButtonKeys.CANCEL);
<a name="line345"></a>};
<a name="line346"></a>
<a name="line347"></a>
<a name="line348"></a>/**
<a name="line349"></a> * Returns the HTML Button element for the button added to this dialog with
<a name="line350"></a> * the given button id.
<a name="line351"></a> * @param {string} buttonId The id of the button to get.
<a name="line352"></a> * @return {Element} The button element if found, else null.
<a name="line353"></a> * @protected
<a name="line354"></a> */
<a name="line355"></a>goog.ui.editor.AbstractDialog.prototype.getButtonElement = function(buttonId) {
<a name="line356"></a>  return this.dialogInternal_.getButtonSet().getButton(buttonId);
<a name="line357"></a>};
<a name="line358"></a>
<a name="line359"></a>
<a name="line360"></a>/**
<a name="line361"></a> * Creates and returns the event object to be used when dispatching the OK
<a name="line362"></a> * event to listeners, or returns null to prevent the dialog from closing.
<a name="line363"></a> * Subclasses should override this to return their own subclass of
<a name="line364"></a> * goog.events.Event that includes all data a plugin would need from the dialog.
<a name="line365"></a> * @param {goog.events.Event} e The event object dispatched by the wrapped
<a name="line366"></a> *     dialog.
<a name="line367"></a> * @return {goog.events.Event} The event object to be used when dispatching the
<a name="line368"></a> *     OK event to listeners.
<a name="line369"></a> * @protected
<a name="line370"></a> */
<a name="line371"></a>goog.ui.editor.AbstractDialog.prototype.createOkEvent = goog.abstractMethod;
<a name="line372"></a>
<a name="line373"></a>
<a name="line374"></a>/**
<a name="line375"></a> * Handles the event dispatched by the wrapped dialog control when the user
<a name="line376"></a> * clicks the OK button. Attempts to create the OK event object and dispatches
<a name="line377"></a> * it if successful.
<a name="line378"></a> * @param {goog.ui.Dialog.Event} e wrapped dialog OK event object.
<a name="line379"></a> * @return {boolean} Whether the default action (closing the dialog) should
<a name="line380"></a> *     still be executed. This will be false if the OK event could not be
<a name="line381"></a> *     created to be dispatched, or if any listener to that event returs false
<a name="line382"></a> *     or calls preventDefault.
<a name="line383"></a> * @protected
<a name="line384"></a> */
<a name="line385"></a>goog.ui.editor.AbstractDialog.prototype.handleOk = function(e) {
<a name="line386"></a>  var eventObj = this.createOkEvent(e);
<a name="line387"></a>  if (eventObj) {
<a name="line388"></a>    return this.dispatchEvent(eventObj);
<a name="line389"></a>  } else {
<a name="line390"></a>    return false;
<a name="line391"></a>  }
<a name="line392"></a>};
<a name="line393"></a>
<a name="line394"></a>
<a name="line395"></a>/**
<a name="line396"></a> * Handles the event dispatched by the wrapped dialog control when the user
<a name="line397"></a> * clicks the Cancel button. Simply dispatches a CANCEL event.
<a name="line398"></a> * @return {boolean} Returns false if any of the handlers called prefentDefault
<a name="line399"></a> *     on the event or returned false themselves.
<a name="line400"></a> * @protected
<a name="line401"></a> */
<a name="line402"></a>goog.ui.editor.AbstractDialog.prototype.handleCancel = function() {
<a name="line403"></a>  return this.dispatchEvent(goog.ui.editor.AbstractDialog.EventType.CANCEL);
<a name="line404"></a>};
<a name="line405"></a>
<a name="line406"></a>
<a name="line407"></a>/**
<a name="line408"></a> * Disposes of the dialog. If the dialog is open, it will be hidden and
<a name="line409"></a> * AFTER_HIDE will be dispatched.
<a name="line410"></a> * @override
<a name="line411"></a> * @protected
<a name="line412"></a> */
<a name="line413"></a>goog.ui.editor.AbstractDialog.prototype.disposeInternal = function() {
<a name="line414"></a>  if (this.dialogInternal_) {
<a name="line415"></a>    this.hide();
<a name="line416"></a>
<a name="line417"></a>    this.dialogInternal_.dispose();
<a name="line418"></a>    this.dialogInternal_ = null;
<a name="line419"></a>  }
<a name="line420"></a>
<a name="line421"></a>  goog.ui.editor.AbstractDialog.superClass_.disposeInternal.call(this);
<a name="line422"></a>};
<a name="line423"></a>
<a name="line424"></a>
<a name="line425"></a>// *** Private implementation *********************************************** //
<a name="line426"></a>
<a name="line427"></a>
<a name="line428"></a>/**
<a name="line429"></a> * The wrapped dialog widget.
<a name="line430"></a> * @type {goog.ui.Dialog}
<a name="line431"></a> * @private
<a name="line432"></a> */
<a name="line433"></a>goog.ui.editor.AbstractDialog.prototype.dialogInternal_;
<a name="line434"></a>
<a name="line435"></a>
<a name="line436"></a>/**
<a name="line437"></a> * Cleans up after the dialog is hidden and fires the AFTER_HIDE event. Should
<a name="line438"></a> * be a listener for the wrapped dialog&#39;s AFTER_HIDE event.
<a name="line439"></a> * @private
<a name="line440"></a> */
<a name="line441"></a>goog.ui.editor.AbstractDialog.prototype.handleAfterHide_ = function() {
<a name="line442"></a>  this.dispatchEvent(goog.ui.editor.AbstractDialog.EventType.AFTER_HIDE);
<a name="line443"></a>};
</pre>


</body>
</html>
